skextremes.utils

This module provides utility functions that are used within scikit-extremes that are also useful for external consumption.

skextremes.utils.bootstrap_ci(data, statfunction=<function average at 0x03071C00>, alpha=0.05, n_samples=100)[source]

Given a set of data data, and a statistics function statfunction that applies to that data, computes the bootstrap confidence interval for statfunction on that data. Data points are assumed to be delineated by axis 0.

This function has been derived and simplified from scikits-bootstrap package created by cgevans (https://github.com/cgevans/scikits-bootstrap). All the credits shall go to him.

Parameters

data : array_like, shape (N, ...) OR tuple of array_like all with shape (N, ...)
Input data. Data points are assumed to be delineated by axis 0. Beyond this, the shape doesn’t matter, so long as statfunction can be applied to the array. If a tuple of array_likes is passed, then samples from each array (along axis 0) are passed in order as separate parameters to the statfunction. The type of data (single array or tuple of arrays) can be explicitly specified by the multi parameter.
statfunction : function (data, weights = (weights, optional)) -> value
This function should accept samples of data from data. It is applied to these samples individually.
alpha : float, optional
The percentiles to use for the confidence interval (default=0.05). The returned values are (alpha/2, 1-alpha/2) percentile confidence intervals.
n_samples : int or float, optional
The number of bootstrap samples to use (default=100)

Returns

confidences : tuple of floats
The confidence percentiles specified by alpha

Calculation Methods

‘pi’ : Percentile Interval (Efron 13.3)

The percentile interval method simply returns the 100*alphath bootstrap sample’s values for the statistic. This is an extremely simple method of confidence interval calculation. However, it has several disadvantages compared to the bias-corrected accelerated method.

If you want to use more complex calculation methods, please, see scikits-bootstrap package.

References

Efron (1993): ‘An Introduction to the Bootstrap’, Chapman & Hall.
skextremes.utils.gev_momfit(data)[source]

Estimate parameters of Generalised Extreme Value distribution using the method of moments. The methodology has been extracted from appendix A.4 on EVA (see references below).

Parameters

data : array_like
Sample extreme data

Returns

tuple
tuple with the shape, location and scale parameters. In this, case, the shape parameter is always 0.

References

skextremes.utils.gum_momfit(data)[source]

Estimate parameters of Gumbel distribution using the method of moments. The methodology has been extracted from Wilks (see references below).

Parameters

data : array_like
Sample extreme data

Returns

tuple
tuple with the shape, location and scale parameters. In this, case, the shape parameter is always 0.

References

Wilks,D.S. (2006): ‘Statistical Methods in the Atmospheric Sciences, second edition‘, Academic Press.